package cn.tx.customer;

import cn.tx.entity.User;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * 消费者 消费消息
 * @author Mxb
 * @version 1.0
 * @date 2020/10/4 9:52
 */
@Component
//绑定队列
@RabbitListener(queuesToDeclare = @Queue("hello"))
public class HelloCustomer {
    //@RabbitHandler
    //public void receive1(String message){
    //    System.out.println("message = " + message);
    //    System.out.println("消费完毕。。。。");
    //}
    @RabbitHandler
    public void receive1(User message){
        System.out.println("message = " + message);
        System.out.println("消费完毕。。。。");
    }

}
